<%--
  Created by IntelliJ IDEA.
  User: xiaoji
  Date: 2015/1/27
  Time: 16:42
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<c:set value="${pageContext.request.contextPath}" var="path" scope="session"/>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
    <title>ACG合同条例设置</title>
    <meta http-equiv="Content-Type" content="text/html;charset=utf-8"/>
    <link rel="stylesheet" type="text/css" href="${path}/plugins/jquery-easyui-1.4.1/themes/default/easyui.css">
    <link rel="stylesheet" type="text/css" href="${path}/plugins/jquery-easyui-1.4.1/themes/icon.css">
    <script type="text/javascript" src="${path}/plugins/jquery-easyui-1.4.1/jquery.min.js"></script>
    <script type="text/javascript" src="${path}/plugins/jquery-easyui-1.4.1/jquery.easyui.min.js"></script>
    <script type="text/javascript" src="${path}/plugins/jquery-easyui-1.4.1/locale/easyui-lang-zh_CN.js"></script>
    <script type="text/javascript" charset="utf-8" src="${path}/plugins/ueditor/ueditor.config.js"></script>
    <script type="text/javascript" charset="utf-8" src="${path}/plugins/ueditor/ueditor.all.min.js"> </script>
    <!--建议手动加在语言，避免在ie下有时因为加载语言失败导致编辑器加载失败-->
    <!--这里加载的语言文件会覆盖你在配置项目里添加的语言类型，比如你在配置项目里配置的是英文，这里加载的中文，那最后就是中文-->
    <script type="text/javascript" charset="utf-8" src="${path}/plugins/ueditor/lang/zh-cn/zh-cn.js"></script>
</head>
<body>
<div class="easyui-panel" title="ACG合同条例设置" style="width:90%">
    <div style="padding:10px 60px 20px 60px">
        <form id="ff" class="easyui-form" method="post" data-options="novalidate:true">
            <table cellpadding="5">
                <tr>
                    <td>ACG合同条例（中）:</td>
                    <td>
                        <script id="editor1" type="text/plain"  style="width:800px;height:140px;">

                        </script>
                    </td>
                </tr>
                <tr>
                    <td>ACG合同条例（英）:</td>
                    <td>
                        <script id="editor2" type="text/plain"  style="width:800px;height:140px;"></script>
                    </td>
                </tr>
            </table>
        </form>
        <div style="text-align:center;padding:5px">
            <a href="javascript:void(0)" class="easyui-linkbutton" onclick="submitForm()">&nbsp;保&nbsp;&nbsp;存&nbsp;</a>
            <a href="javascript:void(0)" class="easyui-linkbutton" onclick="clearForm()">&nbsp;重&nbsp;&nbsp;置&nbsp;</a>
        </div>
    </div>
</div>
<script>
    function submitForm(){
        $.post("${path}/setting/saveContractSet.do",{
            contractCn:getContent(1),
            contractEn:getContent(2)
        }, function(data){
            if(data.errormsg == undefined){
                $.messager.alert('操作提示', '操作成功', 'info');
            }else{
                $.messager.alert('操作提示', data.errormsg, 'error');
            }
        },"json");
    }

    function getContent(id) {
        return UE.getEditor('editor'+id).getContent();
    }
    function clearForm(){
        $('#ff').form('clear');
    }
        //实例化编辑器
        //建议使用工厂方法getEditor创建和引用编辑器实例，如果在某个闭包下引用该编辑器，直接调用UE.getEditor('editor')就能拿到相关的实例
        var ue1 = UE.getEditor('editor1');
        var ue2 = UE.getEditor('editor2');

        ue1.addListener("ready", function () {
            UE.getEditor('editor1').setContent('${contractCn}');
        });
        ue2.addListener("ready", function () {
            UE.getEditor('editor2').setContent('${contractEn}');
        });
</script>
</body>
</html>
